//
//  SINAManagerViewController.m
//  sinashebao
//
//  Created by  androidlongs on 2017/12/29.
//  Copyright © 2017年  androidlongs. All rights reserved.
//

#import "SINAManagerViewController.h"
#import "SINACircularBeadUtils.h"
#import "SINAUiviewClickLiserner.h"
#import "SINATecScroInputViewController.h"
#import "SINAScoreQueryViewController.h"
#import "SINATecApprovalManagerViewController.h"
#import "SINATecSignQueryViewController.h"
#import "SINATecIssueMsgViewController.h"

@interface SINAManagerViewController ()

//成绩录入
@property (weak, nonatomic) IBOutlet UIView *scoreInputView;
//成绩查询
@property (weak, nonatomic) IBOutlet UIView *scoreQueryView;
//审批管理
@property (weak, nonatomic) IBOutlet UIView *approvalManagerView;
//点名查询
@property (weak, nonatomic) IBOutlet UIView *signQueryView;
//发布通知
@property (weak, nonatomic) IBOutlet UIView *issueMsgView;


@end

@implementation SINAManagerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title=@"教务管理";
    
    //圆角设置
    NSInteger bead=1;
    [SINACircularBeadUtils makeCircularBead:bead andView:self.scoreInputView andIsSetBackground:NO];
    [SINACircularBeadUtils makeCircularBead:bead andView:self.scoreQueryView andIsSetBackground:NO];
    [SINACircularBeadUtils makeCircularBead:bead andView:self.approvalManagerView andIsSetBackground:NO];
    [SINACircularBeadUtils makeCircularBead:bead andView:self.signQueryView andIsSetBackground:NO];
    [SINACircularBeadUtils makeCircularBead:bead andView:self.issueMsgView andIsSetBackground:NO];
    
    //点击事件设置
    [[[SINAUiviewClickLiserner alloc]init] viewClickFunction:self.scoreInputView andWithBlick:^(UIView *view) {
        //成绩录入
        DLog(@"成绩录入 ");
        if ([super checkApproveIdent]) {
            SINATecScroInputViewController *scoreInputController = [[SINATecScroInputViewController alloc]initWithNibName:@"SINATecScroInputViewController" bundle:nil];
            scoreInputController.hidesBottomBarWhenPushed=YES;
            [self.navigationController pushViewController:scoreInputController animated:YES];
        }
       
    }];
    [[[SINAUiviewClickLiserner alloc]init] viewClickFunction:self.scoreQueryView andWithBlick:^(UIView *view) {
        //成绩查询
        DLog(@"成绩查询 ");
        if ([super checkApproveIdent]) {
            SINAScoreQueryViewController *scoreQueryController = [[SINAScoreQueryViewController alloc]initWithNibName:@"SINAScoreQueryViewController" bundle:nil];
            scoreQueryController.hidesBottomBarWhenPushed=YES;
            scoreQueryController.pageType=@"成绩查询";
            [self.navigationController pushViewController:scoreQueryController animated:YES];
        }
       
    }];
    [[[SINAUiviewClickLiserner alloc]init] viewClickFunction:self.approvalManagerView andWithBlick:^(UIView *view) {
        //审批管理
        DLog(@"审批管理 ");
        if ([super checkApproveIdent]) {
            SINATecApprovalManagerViewController *approvalManagerController = [[SINATecApprovalManagerViewController alloc]initWithNibName:@"SINATecApprovalManagerViewController" bundle:nil];
            approvalManagerController.hidesBottomBarWhenPushed=YES;
            [self.navigationController pushViewController:approvalManagerController animated:YES];
        }
       
    }];
    [[[SINAUiviewClickLiserner alloc]init] viewClickFunction:self.signQueryView andWithBlick:^(UIView *view) {
        //点名查询
        DLog(@"点名查询 ");
//        SINATecSignQueryViewController *signQueryController =[[SINATecSignQueryViewController alloc]initWithNibName:@"SINATecSignQueryViewController" bundle:nil];
        
        if ([super checkApproveIdent]) {
            SINAScoreQueryViewController *signQueryController = [[SINAScoreQueryViewController alloc]initWithNibName:@"SINAScoreQueryViewController" bundle:nil];
            signQueryController.pageType=@"点名查询";
            signQueryController.hidesBottomBarWhenPushed=YES;
            [self.navigationController pushViewController:signQueryController animated:YES];
        }
    }];
    [[[SINAUiviewClickLiserner alloc]init] viewClickFunction:self.issueMsgView andWithBlick:^(UIView *view) {
        //成绩录入
        DLog(@"发布通知 ");
       
        if ([super checkApproveIdent]) {
            SINATecIssueMsgViewController *issueMsgController =[[SINATecIssueMsgViewController alloc]initWithNibName:@"SINATecIssueMsgViewController" bundle:nil];
            issueMsgController.hidesBottomBarWhenPushed=YES;
            [self.navigationController pushViewController:issueMsgController animated:YES];
        }
    }];
    
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jpushNotificationFunction:)name:notificationKeyNameTecManager object:nil];
    
}
- (void)jpushNotificationFunction:(NSNotification *)dic{
    
    DLog(@"－－－－－接收到通知------%@",dic.userInfo[@"pushMsgType"]);
    
    NSString *pushMsgType = dic.userInfo[@"pushMsgType"];
    
    if (pushMsgType!=nil&& [pushMsgType isEqualToString:@"STULEAVEMSG"]) {
        //学生提交请假申请，推送给审批老师
        SINATecApprovalManagerViewController *approvalManagerController = [[SINATecApprovalManagerViewController alloc]initWithNibName:@"SINATecApprovalManagerViewController" bundle:nil];
        approvalManagerController.hidesBottomBarWhenPushed=YES;
        [self.navigationController pushViewController:approvalManagerController animated:YES];
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [super hiniBackItem];
    
//    [self.navigationController setNavigationBarHidden:YES animated:animated];
}

//-(void)viewWillDisappear:(BOOL)animated
//{
//    [super viewWillDisappear:animated];
//    [self.navigationController setNavigationBarHidden:NO animated:animated];
//}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
